<tc_include file="Public:header" />
<div id="content-container" class="container">
	<div class="es-section testpaper-heading">
		<div class="testpaper-titlebar clearfix">
			<h1 class="testpaper-title">{$title}<br><small class="text-sm">答题人：{$result.userid|getusername} &nbsp&nbsp&nbsp交卷时间：{$result['addtime']} </small></h1>
			<div class="testpaper-status">  
				<if condition="$result['readover'] eq 0">			
					<div class="label label-info">批阅中</div>
				<else />
				    <div class="label label-info">已批阅</div>
				</if>				
			</div>
		</div>

		<div class="media testpaper-result">
			<div class="testpaper-result-total">
				<div class="well">
				    <if condition="$result['readover'] eq 0">
						<div class="testpaper-result-total-score">?<small>分</small></div>
					<else />
					    <div class="testpaper-result-total-score">{$usertotlescore}<small>分</small></div>
					</if>
					<small class="text-muted">总分{$totlescore}分</small>
				</div>
			</div>
			<div class="media-body">
				<div class="table-responsive">
					<table class="table table-bordered table-condensed testpaper-result-table">
						<thead>
							<th></th>
							<if condition="$single_choice_num gt 0">
							  <th>选择题 <small class="text-muted">({$single_choice_num}道)</small></th>
							</if>  
							<if condition="$fill_num gt 0">
								<th>填空题 <small class="text-muted">({$fill_num}道)</small></th>
							</if> 	
							<if condition="$determine_num gt 0">	
								<th>判断题 <small class="text-muted">({$determine_num}道)</small></th>
							</if> 
							<if condition="$essay_num gt 0">	
								<th>问答题 <small class="text-muted">({$essay_num}道)</small></th>
							</if> 	
							<if condition="$material_num gt 0">	
								<th>材料题 <small class="text-muted">({$material_num}道)</small></th>
							</if> 	
						</thead>
						<tbody>
							<tr>
								<th>得分</th>
								<if condition="$single_choice_num gt 0">
									<td><span class="text-success">{$result['choicescore']}<small>分</small></span></td>
								</if>
								<if condition="$fill_num gt 0">
									<if condition="empty($totalfilescore)">
										<td><span class="text-warning"> <small>批阅中</small></span></td>
									<else />
										<td><span class="text-success">{$totalfilescore} <small>分</small></span></td>
									</if>
								</if>	
								<if condition="$determine_num gt 0">	
									<td><span class="text-success">{$result['determinescore']} <small>分</small></span></td>
								</if>	
								<if condition="$essay_num gt 0">	
									<if condition="empty($totalessayscore)">
										<td><span class="text-warning"><small>批阅中</small></span></td>
									<else />
										<td><span class="text-success">{$totalessayscore} <small>分</small></span></td>
									</if>
								</if>	
								<if condition="$material_num gt 0">	
									<if condition="empty($totalmaterialscore)">
										<td><span class="text-warning"><small>批阅中</small></span></td>
									<else />
										<td><span class="text-success">{$totalmaterialscore} <small>分</small></span></td>
									</if>
								</if>	
							</tr>
							
						</tbody>
					</table>
				</div>
			</div>
		</div>  
	</div>
		
    <form name="myform" id="myform" action="{:u('Exam/Shiti/docheckpaperpost')}" method="post" class="form-horizontal js-ajax-form">
		<div class="row">
			<div class="col-md-9 prevent-copy">
				<div class="testpaper-body" >
					
					<if condition="!empty($fill)">
						<div class="panel panel-default testpaper-question-block" id="fill">
							<div class="panel-heading"><strong class="">填空题</strong>
								<small class="text-muted">共{$fill_num}题，每题{$data['fill_score']}分，共{$fill_num*$data['fill_score']}分</small>
							</div>
							<div class="panel-body">
								<foreach name="fill" item="vo"  key="k">
									<div class="testpaper-question testpaper-question-fill "  id="{$single_choice_num+$k+1}">
										<div class="testpaper-question-body">
											<div class="testpaper-question-stem-wrap clearfix">
												<div class="testpaper-question-seq-wrap">
													<div class="testpaper-question-seq">{$single_choice_num+$k+1}</div>
													<div class="testpaper-question-score" >{$data['fill_score']}.0分</div>
													<input class="hidden"  id="{$single_choice_num+$k+1+4000}"  value="{$data['fill_score']}">
												</div>
												<div class="testpaper-question-stem">
													{$vo['stem']}
												</div>
											</div>
										</div>
										<div class="testpaper-question-footer clearfix">
											<div class="testpaper-question-result">
												<div class="testpaper-question-result-suggested">
													<div class="testpaper-question-result-title">参考答案：<strong class="text-success">{$vo['daan']}</strong></div>
												</div>
												<div class="testpaper-question-result-your">
													<div class="testpaper-question-result-title">学员答案：{$vo['userdaan']}</div>
												</div>
												<div class="testpaper-question-result-your" style="margin-top:20px;">
													<label class="col-sm-3 control-label"  id="{$single_choice_num+$k+1+1000}">得分</label>
													<div class="col-sm-4 controls">
														<input type="text" class="form-control score"  id="{$single_choice_num+$k+1+2000}" name="fill[{$vo['id']}]"  value="">
													</div>
													<div class="showmessage" id="{$single_choice_num+$k+1+3000}"></div>
												</div>
											</div>
										</div>
										
									</div>
								</foreach>    	
							</div>
						</div>
					</if>
					<if condition="!empty($essay)">
						<div class="panel panel-default testpaper-question-block" id="essay">
							<div class="panel-heading"><strong class="">问答题</strong>
								<small class="text-muted">共{$essay_num}题，每题{$data['essay_score']}分，共{$essay_num*$data['essay_score']}分 </small>
							</div>
							<div class="panel-body">
								<foreach name="essay" item="vo"  key="k">
									<div class="testpaper-question testpaper-question-fill " id="{$single_choice_num+$fill_num+$determine_num+$k+1}">
										<div class="testpaper-question-body">
											<div class="testpaper-question-stem-wrap clearfix">
												<div class="testpaper-question-seq-wrap">
													<div class="testpaper-question-seq">{$single_choice_num+$fill_num+$determine_num+$k+1}</div>
													<div class="testpaper-question-score">{$data['essay_score']}.0分</div>
													<input class="hidden"  id="{$single_choice_num+$fill_num+$determine_num+$k+1+4000}"  value="{$data['essay_score']}">
												</div>
												<div class="testpaper-question-stem">
													{$vo['stem']}
												</div>
											</div>
										</div>
										<div class="testpaper-question-footer clearfix">
											<div class="testpaper-question-result">
												<div class="testpaper-question-result-suggested">
													<div class="testpaper-question-result-title">参考答案：</div>
													<div><strong class="text-success">{$vo['daan']}</strong></div>
												</div>
												<div class="testpaper-question-result-your">
													<div class="testpaper-question-result-title">学员答案：</div>
													<div>{$vo['userdaan']}</div>
												</div>
												<div class="testpaper-question-result-your" style="margin-top:20px;">
													<label class="col-sm-3 control-label" id="{$single_choice_num+$fill_num+$determine_num+$k+1+1000}">得分</label>
													<div class="col-sm-4 controls">
														<input type="text" class="form-control score" id="{$single_choice_num+$fill_num+$determine_num+$k+1+2000}" name="essay[{$vo['id']}]"  value="">
													   <div class="showmessage" id="{$single_choice_num+$fill_num+$determine_num+$k+1+3000}"></div>
													</div>
												</div>
											</div>
										</div>
									</div>
								</foreach>    	
							</div>
						</div>
					</if>
					<if condition="!empty($material)">
						<div class="panel panel-default testpaper-question-block" id="material">
							<div class="panel-heading"><strong class="">材料题</strong>
								<small class="text-muted">共{$material_num}题，每题{$data['material_score']}分，共{$material_num*$data['material_score']}分</small>
							</div>
							<div class="panel-body">
								<foreach name="material" item="vo"  key="k">
									<div class="testpaper-question testpaper-question-fill "  id="{$single_choice_num+$fill_num+$determine_num+$essay_num+$k+1}">
										<div class="testpaper-question-body">
											<div class="testpaper-question-stem-wrap clearfix">
												<div class="testpaper-question-seq-wrap">
													<div class="testpaper-question-seq">{$single_choice_num+$fill_num+$determine_num+$essay_num+$k+1}</div>
													<div class="testpaper-question-score">{$data['material_score']}.0分</div>
													<input class="hidden"  id="{$single_choice_num+$fill_num+$determine_num+$essay_num+$k+1+4000}"  value="{$data['essay_score']}">
												</div>
												<div class="testpaper-question-stem">
													{$vo['stem']}
												</div>
												
											</div>
										</div>
										<div class="testpaper-question-footer clearfix">
											<div class="testpaper-question-result">
												<div class="testpaper-question-result-suggested">
													<div class="testpaper-question-result-title">参考答案：</div>
													<div><strong class="text-success">{$vo['daan']}</strong></div>
												</div>
												<div class="testpaper-question-result-your">
													<div class="testpaper-question-result-title">学员答案：</div>
													<div>{$vo['userdaan']}</div>
												</div>
												<div class="form-group" style="margin-top:20px;">
													<label class="col-sm-3 control-label" id="{$single_choice_num+$fill_num+$determine_num+$essay_num+$k+1+1000}">得分</label>
													<div class="col-sm-4 controls">
														<input type="text" class="form-control score" id="{$single_choice_num+$fill_num+$determine_num+$essay_num+$k+1+2000}" name="material[{$vo['id']}]"  value="">
														<div class="showmessage" id="{$single_choice_num+$fill_num+$determine_num+$essay_num+$k+1+3000}"></div>
													</div>
												</div>
											</div>
										</div>
									</div>
								</foreach>    	
							</div>
						</div>
					</if>
				</div>
			</div>
			<div class="col-md-3">
				<div class="testpaper-card" data-spy="affix" data-offset-top="200" data-offset-bottom="200">
					<div class="panel panel-default">
						
						<div class="panel-body">
							<for start="1" end="$single_choice_num+$fill_num+$determine_num+$essay_num+$material_num+1">
								<a href="#{$i}" class="btn btn-success btn-index pull-left " id="{$i+100000}">{$i}</a>
							</for>
						</div>
						<input type="hidden" name="papersid" value="{$paperid}">
						<input type="hidden" name="userpaperid" value="{$userpaperid}">
						 <div class="panel-footer">
							<button class="btn btn-success btn-block js-ajax-submit ">完成批阅</button>
						</div>
					</div> 			
				</div>
			</div>
		</div>
	</form>
</div>
<tc_include file="Public:scripts" /> 
<script type="text/javascript"> 
$("#myModal").on("hidden", function() {
    $(this).removeData("modal");
});

</script>  
<script type="text/javascript">
 $(".analysis-btn").click(function(){ 
   var id=$(this).attr('id');
   var id1=parseInt(id)+parseInt(10000);
   var id2=parseInt(id)+parseInt(20000);
    $("#"+id).css('display','none');
    $("#"+id1).css('display','');
	$("#"+id2).css('display',''); 
}); 
$(".unanalysis-btn").click(function(){ 
   var id1=$(this).attr('id');
   var id=parseInt(id1)-parseInt(10000);
   var id2=parseInt(id1)+parseInt(10000);
    $("#"+id1).css('display','none');
    $("#"+id).css('display','');
	$("#"+id2).css('display','none'); 
}); 
$(".score").blur(function(){ 
   var id=$(this).attr('id');
   var totalscoreid=parseInt(id)+parseInt(2000);
   var msgid=parseInt(id)+parseInt(1000);
   var totalscore=$("#"+totalscoreid).val();
   var userscore=$("#"+id).val();
   if(userscore > totalscore ){
      $("#"+msgid).empty();	
      $("#"+msgid).append("<p><font color='red'>赋分不能超过本题最高分</font></p>");
      $("#"+id).attr("value","");	  
   }else{
      $("#"+msgid).empty();	 
   }
}); 
</script>

<tc_include file="Public:footer" />